package com.gwfd.mes.app.core.def.mapper;

import com.gwfd.mes.app.o.TableColumn;
import com.gwfd.mes.app.o.TableRow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 张照威
 * @date 2020/9/15
 * @mail 865533614@qq.com
 * @describe
 */
@Mapper
public interface MesMapper<T>{

    public int deleteBatchLogicByEntityId(
            @Param("tableName") String tableName,
            @Param("entityList") List<T> entityList,
            @Param("tenantId") Long tenantId,
            @Param("lastUpdateBy") Long lastUpdateBy
    );

    public int deleteBatchLogicById(
            @Param("tableName") String tableName,
            @Param("ids") List<String> ids,
            @Param("tenantId") Long tenantId,
            @Param("lastUpdateBy") Long lastUpdateBy
    );


    public int deleteLogicByEntityId(
            @Param("tableName") String tableName,
            @Param("entity") T entity,
            @Param("tenantId") Long tenantId,
            @Param("lastUpdateBy") Long lastUpdateBy
    );

    public int deleteLogicById(
            @Param("tableName") String tableName,
            @Param("id") String id,
            @Param("tenantId") Long tenantId,
            @Param("lastUpdateBy") Long lastUpdateBy
    );

    public int updateById(
            @Param("tableName") String tableName,
            @Param("id") String id,
            @Param("tableColumnList") List<TableColumn> tableColumnList,
            @Param("versionNumber") Integer versionNumber,
            @Param("tenantId") Long tenantId,
            @Param("lastUpdateBy") Long lastUpdateBy
    );


    int updateBatchByEntityId(
            @Param("tableName") String tableName,
            @Param("tableRowList") List<TableRow> tableRowList,
            @Param("tenantId") Long tenantId,
            @Param("userId") Long userId);


    void insertBatch(
            @Param("tableName") String tableName,
            @Param("tableColumnList") List<TableColumn> tableColumnList,
            @Param("tableRowList") List<TableRow> tableRowList);

    void insertBatch2(
            @Param("tableName") String tableName,
            @Param("colName") String colName,
            @Param("colValue") String colValue);
}
